Skip to content

multi-threaded model initialization#737

Open
ngc92 wants to merge 1 commit intokarpathy:masterfrom
ngc92:threaded-init
Open

multi-threaded model initialization#737
ngc92 wants to merge 1 commit intokarpathy:masterfrom
ngc92:threaded-init

Conversation

@ngc92
Copy link
Copy Markdown
Contributor

@ngc92 ngc92 commented Aug 12, 2024

A simple demonstration of initializing from multiple threads.
Factored out the parallel part; by making it a separate function, it becomes less likely that we accidentally change shared state by using variables from the outer scope.

Comment thread train_gpt2.cu
}

void gpt2_init_layer(GPT2 *model, int l, mt19937_state* rng, floatX* params) {
int offset = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be size_t for larger model sizes.

@ademeure
Copy link
Copy Markdown
Contributor

Looks good to me, it improves startup time for -e "d72" from ~100s to ~15s on a 1xH100 node with 26 CPU cores! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants